package com.zbf.auth.config;

import com.zbf.common.utils.TwitterIdWorker;
import net.bytebuddy.dynamic.scaffold.MethodGraph;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 作者: LCG
 * 日期: 2020/6/15 17:24
 * 描述:
 */
@Configuration
public class ConfigInfo {

    /**
     * 线程池
     * @return
     */
    @Bean
    public ThreadPoolExecutor getThreadPoolExecutor(){
        LinkedBlockingQueue<Runnable> linkedBlockingQueue=new LinkedBlockingQueue<>();
        ThreadPoolExecutor threadPoolExecutor=new ThreadPoolExecutor(8,8,30,TimeUnit.MINUTES,linkedBlockingQueue);
        return threadPoolExecutor;
    }

    @Bean
    public TwitterIdWorker getTwitterIdWorker(){
        return new TwitterIdWorker();
    }

}
